//
// Created by 张祎鹤严 on 2022/12/10.
//

#ifndef _TASK_LOSTCOUNTER_H
#define _TASK_LOSTCOUNTER_H
#include "main.h"

#define LOST_COUNTER_TIME_MS (50)

#define NUMBERS_OF_COUNT (16)

enum LostCounterType
{
    REMOTE_LOST_COUNT                 = 0,
    JUDGEMENT_LOST_COUNT			  = 1,
    FEEDMOTOR_LOST_COUNT,
    CHASSIS_MOTOR_0,
    CHASSIS_MOTOR_1,
    CHASSIS_MOTOR_2,        // 5
    CHASSIS_MOTOR_3,
    L_FRICTION_LOST_COUNT,
    R_FRICTION_LOST_COUNT,
    H_FRICTION_LOST_COUNT,
    GIMBAL_MOTOR_PITCH,     // 10
    GIMBAL_MOTOR_YAW,
    SUPERC_LOST_COUNT,
    VISION_LOST_COUNT,
    SMALL_PITCH_COUNT,
    SCOPE_LOST_COUNT,
};

#define CHASSIS_LOST_TOLERANCE_MS			1000
#define GIMBAL_LOST_TOLERANCE_MS			200
#define REMOTE_LOST_TOLERANCE_MS			300
#define VISION_LOST_TOLERANCE_MS			200
#define JUDGEMENT_LOST_TOLERANCE_MS		    800
#define FEEDMOTOR_LOST_TOLERANCE_MS		    200

void LostCounterInit(void);
void LostCounterFeed(uint8_t i);
void LostCounterControl(uint16_t SystemErrorStatus);
uint16_t GetErrorState(void);


#endif //_TASK_LOSTCOUNTER_H
